<%@ page import="com.genghis.ptas.classroom.entity.ClassroomInfo" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <meta charset="utf-8"/>
    <title>试题信息</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
    <meta content="" name="description"/>
    <meta content="" name="author"/>

    <%@include file="../../common.jsp" %>

    <link href="assets/css/style.css" rel="stylesheet" type="text/css">
    <!--文本编辑-->
    <link rel="stylesheet" type="text/css" href="assets/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.css"/>
    <link rel="stylesheet" type="text/css" href="assets/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
    <link href="assets/css/style.css" rel="stylesheet" type="text/css"/>
    <link href="assets/css/plugins.css" rel="stylesheet" type="text/css"/>
    <link href="assets/css/pages/profile.css" rel="stylesheet" type="text/css"/>
    <!--文本编辑-->

    <!-- BEGIN GLOBAL MANDATORY STYLES -->
    <link href="corporate/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
    <link href="corporate/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <!-- END GLOBAL MANDATORY STYLES -->

    <!-- BEGIN PAGE LEVEL PLUGIN STYLES -->
    <link href="corporate/plugins/fancybox/source/jquery.fancybox.css" rel="stylesheet"/>
    <!-- END PAGE LEVEL PLUGIN STYLES -->

    <!-- BEGIN THEME STYLES -->
    <link href="corporate/css/style-metronic.css" rel="stylesheet" type="text/css"/>
    <link href="corporate/css/style.css" rel="stylesheet" type="text/css"/>
    <link href="corporate/css/themes/blue.css" rel="stylesheet" type="text/css" id="style_color"/>
    <link href="corporate/css/style-responsive.css" rel="stylesheet" type="text/css"/>
    <link href="corporate/css/pages/prices.css" rel="stylesheet" type="text/css"/>
    <link href="corporate/css/custom.css" rel="stylesheet" type="text/css"/>
    <!-- END THEME STYLES -->
    <link rel="shortcut icon" href="favicon.ico"/>
    <%List<ClassroomInfo> classroomInfoList = (List<ClassroomInfo>) request.getAttribute("classroomInfoList");%>
    <style>
        .mar{
            margin-top: 20px
        }
    </style>
</head>
<!-- END HEAD -->

<!-- BEGIN BODY -->
<body>
<!-- BEGIN PAGE CONTAINER -->
<div class="page-container">

    <!-- BEGIN BREADCRUMBS -->
    <div class="row breadcrumbs margin-bottom-40">
        <div class="container">
            <div class="col-md-4 col-sm-4">
                <h1>试题信息</h1>
            </div>
        </div>
    </div>
    <!-- END BREADCRUMBS -->

    <!-- BEGIN CONTAINER -->
    <div class="container min-hight">
        <!-- BEGIN PRICING OPTION1 -->
        <div class="form-inline" style="background-color: white;position: fixed;float: left">
            <label for="examinationName">试卷名称</label>
            <input type="text" disabled="disabled" class="form-control" name="examinationName" id="examinationName"
                   value="${examinationInfo.examinationName}"/><br/>

            <label for="examinationType" class="mar">试卷类型</label>
            <input type="text" disabled="disabled" class="form-control" name="examinationType" id="examinationType"
                   value="${examinationInfo.showExaminationType}"/><br/>

            <label for="establishData" class="mar">创建时间</label>
            <input type="text" disabled="disabled" class="form-control" name="establishData" id="establishData"
                   value="${examinationInfo.establishData}"/><br/>

            <div class="mar">
                <span style="font-size: 15px">更换背景颜色</span>
                <input type="radio" onclick="changeBackGround('#EEE8AA')" name="backColor" checked="true"/>书香
                <input type="radio" onclick="changeBackGround('#99CC99')" name="backColor"/>护眼
                <input type="radio" onclick="changeBackGround('#9999FF')" name="backColor"/>天蓝<br/>
                <a class="btn btn-primary mar" onclick="submitExamination()">提交试题<i class = "m-icon-swapright m-icon-white"></i></a>
            </div>
        </div>
        <div id="backGround" style="background-color: #EEE8AA;margin-right: auto;margin-left: 30%; width:75%; ;height: auto;float: right">
            <c:forEach var="typeValue" items="${type}">
                <div style="margin-left: 10px" id="${typeValue.dictCode}" name="${typeValue.dictCode}"></div>
            </c:forEach>
        </div>
        <!-- END PRICING OPTION1 -->
    </div>
    <!-- END CONTAINER -->

</div>
<!-- END PAGE CONTAINER -->

<!-- BEGIN COPYRIGHT -->
<div class="copyright">
    <div class="container">
        <div class="row">
            <div class="col-md-8">
                <p>
                    <span class="margin-right-10">2014 © 长春工业大学. 苏格拉没有底开发小队 版权所有 </span>
                </p>
            </div>
            <div class="col-md-4">
                <ul class="social-footer">
                    <li><img src="ecommerce/img/payments/western-union.jpg" alt="We accept Western Union"
                             title="We accept Western Union"></li>
                    <li><img src="ecommerce/img/payments/american-express.jpg" alt="We accept American Express"
                             title="We accept American Express"></li>
                    <li><img src="ecommerce/img/payments/MasterCard.jpg" alt="We accept MasterCard"
                             title="We accept MasterCard"></li>
                    <li><img src="ecommerce/img/payments/PayPal.jpg" alt="We accept PayPal" title="We accept PayPal">
                    </li>
                    <li><img src="ecommerce/img/payments/visa.jpg" alt="We accept Visa" title="We accept Visa"></li>
                </ul>
            </div>
        </div>
    </div>
</div>
<!-- END COPYRIGHT -->
<!-- Load javascripts at bottom, this will reduce page load time -->
<!-- BEGIN CORE PLUGINS(REQUIRED FOR ALL PAGES) -->
<!--[if lt IE 9]>
<script src="corporate/plugins/respond.min.js"></script>
<![endif]-->
<script src="corporate/plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="corporate/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<script src="corporate/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript" src="corporate/plugins/hover-dropdown.js"></script>
<script type="text/javascript" src="corporate/plugins/back-to-top.js"></script>
<!-- END CORE PLUGINS -->
<script src="<c:url value="/js/common/common.js"/>" type="text/javascript"></script>
<base href="<%=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()%><c:url value="/"/>"/>

<!-- BEGIN PAGE LEVEL JAVASCRIPTS(REQUIRED ONLY FOR CURRENT PAGE) -->
<script type="text/javascript" src="corporate/plugins/fancybox/source/jquery.fancybox.pack.js"></script>
<script src="corporate/scripts/app.js"></script>

<!-- END PAGE LEVEL JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>
<script type="text/javascript">
    jQuery(document).ready(function () {
        App.init();
        displayExaminationInfoToCache();
    });

    function doExamination(id) {
        window.location.href = basePath + "classroom/enterClassroomInfoDo?id=" + id;
    }

    function displayExaminationInfoToCache() {
        $.ajax({
            url: basePath + "task/examination/displayExaminationInfoToCache?examinationInfoId=${examinationInfo.id}",
            dataType: "json",
            type: "POST",
            success: function (info) {
                for (var i = 0; i < info.length; i++) {
                    if (info[i].taskType == 1) {
                        $("#" + info[i].taskType).append("<div name='task'  id='t" + info[i].id + "'>");
                        $("#" + info[i].taskType).append("<p name=" + info[i].id + ">" + info[i].title + "(<textarea name='answer' id='"+ info[i].id +"answer' style='width: 40px;height: 20px'> </textarea>)</p>");
                        for (var j = 0; j < info[i].optionNumber; j++) {
                            $("#" + info[i].taskType).append("</br><p name=" + info[i].id + ">" + info[i].options[j].optionContent + "</p>");
                        }
                        $("#" + info[i].taskType).append("<p hidden='hidden' id='"+info[i].id+"answerRight'>"+ info[i].answer +" </p></div>");
                        $("#" + info[i].taskType).append("<p hidden='hidden' id='"+info[i].id+"taskScore'>"+ info[i].taskScore +" </p></div>");
                        $("#" + info[i].taskType).append("</div>");
                    } else {
                        $("#" + info[i].taskType).append("<div name='task' id=" + info[i].id + ">");
                        $("#" + info[i].taskType).append("'+info[i].title+'</br>(答：<textarea name='answer' id='"+ info[i].id +"answer' style='width: 80px;height: 40px'> </textarea>)");
                        $("#" + info[i].taskType).append("<p hidden='hidden' id="+info[i].id+"'answerRight'>"+ info[i].answer +" </p></div>");
                        $("#" + info[i].taskType).append("<p hidden='hidden' id='"+info[i].id+"taskScore'>"+ info[i].taskScore +" </p></div>");
                        $("#" + info[i].taskType).append("</div>");
                    }
                }
            },
            error: doError
        })
    }

    function changeBackGround(color){
       $("#backGround").css('background-color', color);
    }

    function submitExamination(){
        var answerList = $("[id$=answer]");
        var answerRightList = $("[id$=answerRight]");
        var taskScore = $("[id$=taskScore]");
        var allScore=0;
        for (var i= 0; i<answerList.length;i++){
            if($(answerList[i]).val().trim()==$(answerRightList[i]).html().trim()){
                allScore += $(taskScore[i]).html().trim();
            }
        }
        parent.bootbox.alert("您当前的分数是:" + allScore%101 + "    继续加油！");
    }
</script>